map = require "map"

function getTitleType( DataX, DataY)
    local oldPosIndex =  (DataX + (DataY - 1)* 500) *2 

    local step = math.floor( (oldPosIndex -1) / 100)

    local content = map[step + 1]

    local offset = (oldPosIndex - step * 100) 

    local info = string.sub(content , offset,offset )   --地块类型

    local data = string.byte(info) - 36

    local info2 = string.sub(content , offset-1,offset- 1) --地块值

    local data2 = string.byte(info2) - 36

    return data2 , data
end


local inf = ""
for i=1,500 do
	for j=1,500 do
		local d1 ,d2 = getTitleType( i, j)
	
		print (d1)
		print (d2)
	end
end



-- local p = {x =1,y = 30}
-- -- 2. 0  * 500  + 3   
-- local oldPosIndex = ((p.x - 1) * 500) + p.y
-- print (arr[oldPosIndex])
-- print (arr1[oldPosIndex])